-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improving queue type on processor to avoid casting #394
Conversation
QueueType extends Queue<JobPayload, JobReturn> = Queue<JobPayload, JobReturn>, | ||
QueueType extends Queue<JobPayload, JobReturn, string, JobPayload, JobReturn, string> = Queue< | ||
JobPayload, | ||
JobReturn, | ||
string, | ||
JobPayload, | ||
JobReturn, | ||
string | ||
>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As JobPayload
is not defined at this stage, TS can't infer NameType
export declare class Queue<..., DefaultNameType extends string = string, ..., NameType extends string = ExtractNameType<DataTypeOrJob, DefaultNameType>> {
type ExtractNameType<DataTypeOrJob, Default extends string> = DataTypeOrJob extends Job<any, any, infer N> ? N : Default;
So trying to define it explicitly to help TS
I tested it locally by linking AP to this version of the library and looks like it is working with BullMqPro so I think it should be fine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fantastic work, Carlos, thank you!
Changes
Checklist
major
,minor
,patch
orskip-release